package com.xxx.datalake.service;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

/**
 * @ Author: Aneve
 * @ Project: datalake
 * @ Since: 2022/9/20 19:36
 * @ Description:
 */
public class HBaseConnection {
    private Connection connection = null;

    public Admin getHBaseConnection(String hbaseUri) throws IOException {

        Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.quorum",hbaseUri);
        connection = ConnectionFactory.createConnection(configuration);
        return connection.getAdmin();
    }

}
